package com.stupid.eureka.client.rec.controllers;

import com.stupid.eureka.client.rec.clients.OrderClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@Slf4j
public class RecController {

    @Autowired
    private OrderClient orderClient;

    @RequestMapping(value = "/createOrder", method = RequestMethod.POST)
    public ResponseEntity<String> createOrder(@RequestBody Map<String, String> order){
        log.info("begin invoke order service to create order");
        orderClient.createOrder(order);
        log.info("complete invoke order service to create order");
        return new ResponseEntity<>("create order successfully", HttpStatus.OK);
    }


}
